package cn.edu.zjicm.wordsnet_d.view;

import android.content.Context;
import android.view.View;

public class viewPagerParent extends HorizontalViewPager {
	float xDown, xUp;
	int moveDirection = 0;
	int pagerItem;
	boolean isParentEnable = false;

	public viewPagerParent(Context context) {
		super(context);
	}

	@Override
	protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
		if (v != this && v instanceof HorizontalViewPager) {
			int currentItem = ((HorizontalViewPager) v).getCurrentItem();
			int countItem = ((HorizontalViewPager) v).getAdapter().getCount();
			if ((currentItem == (countItem - 1) && dx < 0) || (currentItem == 0 && dx > 0)) {
				return false;
			}
			return true;
		}
		return super.canScroll(v, checkV, dx, x, y);
	}
}
